package gui;

import gui.TableDemo.MyTableModel;
import junit.framework.TestCase;

public class TableDemoTest extends TestCase {
	
	TableDemo table;
	TableDemo.MyTableModel modeloa;
	Object[] lerroa = {"A", "B", "Kirola", new Integer(3), new Boolean(true)};

	protected void setUp() throws Exception {
		super.setUp();
		table = new TableDemo();
		modeloa = table.new MyTableModel();		
		
	}

	public void testTableDemo() {
		assertNotNull(table);
		
	}
	
	public void testMyTableModel(){
		assertNotNull(modeloa);
	}
	
	public void testLerroaGehitu() {
		Integer hasierakoTamaina = modeloa.getRowCount();
		table.lerroaGehitu(lerroa);
		assertEquals(modeloa.getRowCount(),hasierakoTamaina+1);
	
	}
	
	
	public void testGetColumnCount() {
        assertEquals(modeloa.getColumnCount(),5);
    }

    public void testGetRowCount() {
    	assertEquals(modeloa.getRowCount(),5);
       
    }

    public void testGetColumnName() {
    	assertEquals(modeloa.getColumnName(1), "First Name");
    }

    public void testGetValueAt() {
        assertEquals(modeloa.getValueAt(2, 2),"Doe");
    }
    
    public void testSetValueAt(){
    	modeloa.setValueAt("Proba", 2, 2);
    	assertEquals(modeloa.getValueAt(2, 2),"Proba");
    }

}
